package org.hdax.dm.controller;

import org.hdax.dm.request.QueryItemPriceRequest;
import org.hdax.dm.request.QueryItemSchedulerRequest;
import org.hdax.dm.service.DmSchedulerService;
import org.hdax.dm.vo.CommonResponse;
import org.hdax.dm.vo.entity.scheduler.VoScheduler;
import org.hdax.dm.vo.entity.scheduler_seat_price.VoSchedulerSeatPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping
public class SchedulerConstroller {
    @Autowired
    private DmSchedulerService dmSchedulerService;

    /**
     * 根据商品ID查询商品排期
     *
     * @param queryItemSchedulerRequest
     * @return
     */
    @PostMapping(path = "/p/queryItemScheduler")
    @ResponseBody
    public CommonResponse<List<VoScheduler>> queryItemScheduler(@RequestBody QueryItemSchedulerRequest queryItemSchedulerRequest) {
        return dmSchedulerService.queryItemScheduler(queryItemSchedulerRequest.getItemId());
    }

    /**
     * 根据商品排期查询商品价格
     */
    @PostMapping(path = "/p/queryItemPrice")
    @ResponseBody
    public CommonResponse<List<VoSchedulerSeatPrice>> queryItemPrice(@RequestBody QueryItemPriceRequest queryItemPriceRequest) {
        return dmSchedulerService.queryItemPrice(queryItemPriceRequest.getScheduleId());
    }
}
